---
title: Data model
summary: DBConnectionAPI has no persistent data model; connections are resolved at run time and only two constant connectivity probes touch a database.
status: draft
owner: Architecture
last_reviewed: 2026-10-09
---

# Data model

DBConnectionAPI has no tables, entities, mappings or stored procedures. It accesses databases only to run two constant connectivity probes through the NHibernate unit of work (`IUnitOfWorkFactory`, registered by `AddNhibernateServices<Startup>()`), and the databases it probes are chosen at run time by the caller.

## Connections

Connection strings are not declared in configuration. Each connection is composed at run time from an Environment API template and a secure credential, and the API returns the composed string to the caller; see [Configuration](configuration.md) for the resolution chain and setting key names. The API itself consumes no connection of its own, and no pool code is used.

| Connection | Pool code | Access method | Purpose |
| --- | --- | --- | --- |
| Caller-named Oracle alias | Not applicable | NHibernate `IUnitOfWorkFactory` with `DatabaseType.Oracle`, unit name `temp` | Connectivity probe before the string is cached and returned |
| Caller-named SQL Server instance | Not applicable | NHibernate `IUnitOfWorkFactory` with `DatabaseType.Sql`, unit name `temp2` | Connectivity probe before the string is cached and returned |
| Caller-named PostgreSQL instance | Not applicable | None | Never probed ([BR-DBC-020](business-rules.md#br-dbc-020-postgresql-strings-are-never-probed)) |

## Connectivity probes

| Database | Statement | Executed by | Result handling |
| --- | --- | --- | --- |
| Oracle | `SELECT 1 FROM DUAL` | `ConnectionManager.TestOracleConnection` ([OP-03](operations/op-03-get-oracle-connection-string.md)) | A non-null result means valid ([BR-DBC-018](business-rules.md#br-dbc-018-probe-validity-definition)) |
| SQL Server | `SELECT 1` | `ConnectionManager.TestSqlConnection` ([OP-01](operations/op-01-get-sql-connection-string.md)) | A non-null result means valid ([BR-DBC-018](business-rules.md#br-dbc-018-probe-validity-definition)) |

Both statements are constant, parameterless and read-only, so caller input never enters the SQL text. The `DUAL` pseudo-table is built into Oracle and is not an application table. Each probe runs on a unit of work that is disposed after use, and no transaction is begun.

## Tables

No application table is read or written, so there is no table catalog, schema or CRUD matrix.

## Entity mappings

None. The API defines no `DbContext`, `ClassMap`, `.hbm.xml` mapping or entity class.

## Stored procedures

No stored procedures or PL/SQL packages are referenced by this service; its only database access is the two raw `CreateSqlQuery` probe statements.

## Named queries

None. The API defines no NHibernate named queries.

## In-memory data shapes

| Shape | Kind | Fields or format | Source |
| --- | --- | --- | --- |
| Connection cache | In-memory `Dictionary<string,string>` held by the singleton `ConnectionManager` | Cache key to composed string; never expires ([BR-DBC-002](business-rules.md#br-dbc-002-cache-key-format), [BR-DBC-004](business-rules.md#br-dbc-004-cache-entries-never-expire)) | `DBConnectionAPI/DBConnectionAPI/Services/ConnectionManager.cs` |
| Connection string response | `string` | Template with placeholders substituted | `DBConnectionAPI/DBConnectionAPI/Controllers/ConnectionsController.cs` |
| Admin connection info | `Dictionary<string,string>` | `credentials`, `user`, `pw`, `connectionString`, optional `Error` ([BR-DBC-023](business-rules.md#br-dbc-023-admin-inspection-discloses-raw-credentials)) | `DBConnectionAPI/DBConnectionAPI/Controllers/AdminController.cs` |
| Secure credential setting | Environment API secure string | User name and password separated by a pipe | `DBConnectionAPI/DBConnectionAPI/Services/ConnectionManager.cs` |

## Related documentation
- [API index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Hosting pipeline](hosting-pipeline.md)
- [Endpoints](endpoints.md)
- [Authentication and authorization](authentication-authorization.md)
- [Dependencies](dependencies.md)
- [Configuration](configuration.md)
- [Operations and processes](operations-processes.md)
- [Business rules](business-rules.md)
- [Operational runbook](operational-runbook.md)
- [Tech debt](tech-debt.md)

## Sources
- DBConnectionAPI/DBConnectionAPI/Services/ConnectionManager.cs
- DBConnectionAPI/DBConnectionAPI/Controllers/AdminController.cs
- DBConnectionAPI/DBConnectionAPI/Controllers/ConnectionsController.cs
- DBConnectionAPI/DBConnectionAPI/Startup.cs
